package com.example.cloudkafka;

import com.example.cloudkafka.common.KafkaSender;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class CloudkafkaApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(CloudkafkaApplication.class, args);


		KafkaSender sender = context.getBean(KafkaSender.class);

		for (int i = 0; i < 1000; i++) {
			//调用消息发送类中的消息发送方法
			sender.sendMessage("=============第"+i+"次发送信息！");

//			try {
//				//Thread.sleep(100);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
		}

	}
}
